package com.example.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;

import javax.annotation.PostConstruct;
import com.alibaba.dubbo.config.annotation.Reference;
import org.com.micro.service.HelloService;

import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {

	@Reference
  	private HelloService demoService;
	@Autowired
	Consumer consumer;

	public static void main(String[] args) {
		
		SpringApplication.run(DemoApplication.class, args);
	}
	
    @PostConstruct
    public void init() {
    	if(demoService==null) {
    		demoService=consumer.getService(HelloService.class);
    	}
    	String sayHello = demoService.sayHello("world");
    	System.err.println(sayHello);
    }
}
